Repository navigation
DEV-1459: merge master (#343) into DEV-1459, and write an audio mode set before a read - #352
Merged
Merged
Conversation
Byte 232 holds the button mode, the log triggers and the TTL input enable on LogAndStream firmware with the event channel. The full configuration write built its image from zeros, so every configure from Consensys or the Android config dialog put 0 there and turned the button back to legacy. - ButtonLogMode: the byte's fields and the firmware's correction rules (log-and-stream-common shimmer_button_log_mode.c, via the web SDK's buttonLogMode.ts), including press recording and the TTL input taken out on SR48-6-0. - ShimmerObject: the parse keeps the byte as read, 0xFF included, and the generator writes it back (corrected where it can be trusted). Before packing bytes 217 and 218 it holds userButtonEnable at the button mode's nearest equivalent and clears singleTouchStart where no press can start logging, as the firmware does. Getters and setters for the three fields, and config labels for them. - The byte is trusted only when the Shimmer ACKed the probe, or the value read is one the firmware keeps: firmware without it leaves 0xFF, and the dock cannot probe. - ShimmerVerObject.isSupportedSetFeature(): SET_FEATURE arrived with log-and-stream-common, in LogAndStream_Shimmer3R v1.0.52 and LogAndStream_Shimmer3 v1.0.20. Older firmware discards 0xB7 and runs the two bytes after it as commands (03 is GET_SAMPLING_RATE, which is ACKed), so it is never sent there. The layout places byte 232 from those releases on; the event channel's builds report the release before them, so the version cannot say more. - ShimmerBluetooth.readEventChannelSupport(): SET_FEATURE with FEATURE_EVENT_STREAM and 0, sent on connect. ACK means the event channel is there; the NACK is handled without dropping the link, and still counts towards the operation's progress. - writeConfigBytes(): when the byte was never read nor set, as when a configuration is written on connect before the read, the chunk at 128 is sent either side of byte 232, so the Shimmer keeps its own. Not benched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
LogAndStream_Shimmer3 v1.00.017 is the first release whose log-and-stream-common pin has SET_FEATURE (df58877, with the two-byte argument fix e5ea88c). From v1.00.017 to v1.00.019 the module sat at LogAndStream/log-and-stream-common, and v1.00.017 builds its Bluetooth handler from there. The earlier check looked only at the path v1.00.020 moved it to. The gate moves to v1.0.17, the same release isSupportedRn4678ErrorDetection() already uses. Those releases NACK FEATURE_EVENT_STREAM, so they read as having no event channel, and their SET_INFOMEM handler is the same one that takes the split write around byte 232. Co-Authored-By: Claude Opus 5.5 <[email protected]>
applyButtonLogModeRules() kept singleTouchStart wherever byte 232 left a press that can start logging. That rule exists only in a firmware build with IS_SUPPORTED_SINGLE_TOUCH, and no LogAndStream release has it: every one clears the bit on each configuration it takes, whatever byte 232 holds. So a full write sent a bit the Shimmer drops, and the driver showed single touch on where it never acts. - The rules now clear singleTouchStart on firmware that has byte 232 (LogAndStream from the release that brought SET_FEATURE, the same gate the layout uses), and keep userButtonEnable at the button mode's nearest equivalent there as before. - On other firmware they change nothing. A byte 232 setter called for an SDLog Shimmer, or LogAndStream before the byte, used to move userButtonEnable and clear single touch on firmware that has neither rule, and SDLog is the one firmware the driver offers Single Touch Start for. - API_00037: single touch is cleared in every mode, 0xFF included, and firmware without the byte keeps bytes 217 and 218. All three tests fail on the old rule. Not benched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in DEV-1408 (the callback consumer thread survives a throwing handler). No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hannel readEventChannelSupport()'s javadoc: no Shimmer3 release has it yet, and the builds before a release report the release before them, so the driver still asks rather than going by the version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves the conflict #343 predicted with #293 (DEV-982) in processNotStreamingWaitForAck(): the event channel probe's NACK is taken first, then any other NACK as a refusal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nnel status The Java driver now does the host side of the event channel that the web SDK does (log-and-stream-common docs/SHIMMER3_EVENT_CHANNEL.md and SHIMMER3_BT_COMMUNICATION_PROTOCOL.md section 7.15): - EventFile, EventRecord: the SD card's events/ files, a 64-byte header and 16-byte records, with pairing to the data file by its initial timestamp. - writeEventStream(boolean): SET_FEATURE / FEATURE_EVENT_STREAM. Each record frame, [0x8A][0xBB][0x10][record][CRC-16], reaches EventChannelListener. Frames are taken between data packets (any link CRC mode), straight after the opt-in's ACK, at the start of the buffer, and when idle, including before a command's ACK or reply. They are only parsed after an opt-in, and only once their own CRC checks out. - readEventChannelStatus(): GET_EVENT_CHANNEL_STATUS_COMMAND (0xB9). Not streaming only: its reply is not wrapped in 0x8A, so the streaming parser could not tell it from a packet. Tests port the web SDK's tests/events/record.test.ts inputs and results, and run the IO thread over an in-memory radio for the streaming and idle paths. Android's Shimmer.java overrides the streaming parser and does not know the frame, so it must not opt in until ported. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… event channel Tools > Event markers (Shimmer3R), or the EVENT MARKERS button, opens a window that does with the Java driver what Shimmer Capture web does with the web SDK: - whether the unit has the event channel, and asking again; - configuration byte 232 (button mode, what starts logging, TTL input), written with the whole configuration and read back; - opt in / opt out, the live records with sequence gaps flagged, and the frame and bad-CRC counters; - the event channel status (not while streaming); - an event file from a card: its header, completeness, the data file it pairs with, and its records timed from the file open. Each live edge is also marked on the main plot as a red vertical bar, placed by the latest data packet's Shimmer clock against the plot's PC-time axis. CI does not build ShimmerPCBasicExamples; built locally. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DEV-971: Java event markers - event files, live records, status, and a test window
Each was first reproduced by a test that failed on the unchanged code (API_00044_EventStreamReviewReproTest), then fixed: 1. Idle: event records right behind an in-stream reply were lost. After an unsolicited status push ([ACK][0x8A][0x71]), sent on a dock, an undock or a press that starts logging, clearSerialBuffer() wiped the records queued behind it (0 of 2 arrived). With the event channel on, the bytes after the reply are now left for the next pass. A record frame after a stray ACK no longer has link-CRC bytes cleared after it either: it carries its own CRC. 2. Streaming: an ACK nobody waited for, before a record frame, re-ran the ACK handling of the SET that went last. It is now taken only while an ACK is awaited. 3. Streaming with no link CRC: the packet before a 0x8A was taken as a packet even when the 0x8A was a data byte after a lost byte, so misframed bytes reached the app as a sample. It is now taken only once the frame after it passes its own CRC; otherwise the bytes are discarded as before. 4. readEventChannelStatus() could be queued behind a start of streaming not yet acknowledged, and its unwrapped reply, [ACK][0xBA][9], was then not taken between data packets and the command timed out. It is now refused while a start of streaming is queued, and a reply that still arrives between packets is taken. ShimmerDriver 219/219 and ShimmerDriverPC 154/154 pass; the Java 8 MATLAB jar builds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ehind a bare ACK's CRC From the review of #349: - The idle tests' radios now take each burst whole and let reads wait for their bytes, as a serial port does (WaitingTestRadio), so the IOThread can no longer race the test's writes. API_00043's idle tests use it too. - The status-push, frame-after-ACK and status-reply tests now run with no link CRC, a 1-byte and a 2-byte one. - The misframing test checks that the good packets after the damaged one still arrive; the status-reply test that the command is retired, the lock released, the timer cancelled and the packets either side parsed. The CRC runs reproduced one more defect, which is fixed here: with a link CRC on (the driver turns it on at connect where the firmware has it), the records sent in the same burst as the opt-in's ACK were lost, 0 of 2. The bare ACK's link CRC is left after the ACK is taken; the idle path read it as an unknown byte and cleared the whole serial buffer, records included. With the event channel on, the idle path now drops only the bytes it read. All 7 tests in API_00044 fail on #348's code and pass here. ShimmerDriver 219/219, ShimmerDriverPC 155/155; the Java 8 MATLAB jar builds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DEV-971: fix five event-channel parser defects found in #348's review
… tests From the review of #343: - A Bluetooth configuration write before any read sent a Shimmer3R's byte 233 (DEV-99 audio mode and gain, DEV-1413 sound level) as 0, which turned the unit's audio mode off. It is now left out as byte 232 is, unless it was read or the sound level is turned on, on the same firmware. writeMem() takes a list of bytes to leave out. 3 of the 5 tests in API_00047_AudioConfigWriteTest fail without it. - The event channel probe's NACK now goes through processNackFromCommand(), which marks the event channel unsupported and does not report the NACK as a refused command. processEventChannelProbeNack() is gone. - API_00036_ButtonLogModeTest and API_00037_ButtonLogModeConfigWriteTest are now API_00045 and API_00046: master's log-start-refused tests have those numbers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DEV-971: #343 review fixes - leave byte 233 out before a read, one NACK handler, renumber tests
DEV-971: keep configuration byte 232 on a full write, expose its fields, probe for the event channel
Conflicts, all resolved by keeping both sides: - ShimmerBluetooth: the command and response maps (GET_AUDIO_STATUS and GET_EVENT_CHANNEL_STATUS), and the in-stream response branches. - ShimmerObject: the 0xB9-0xBB and 0xBC-0xBD command constants. - Configuration: the AUDIO_MODE and BUTTON_MODE/LOG_TRIGGERS/TTL_INPUT labels. - ConfigByteLayoutShimmer3: byte 232's index beside the audio layout. - SensorSoundLevel: the parse sets the audio mode and marks byte 233 read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Master's byte 233 rule (#351) leaves the byte out of a configuration written before it is read, unless it was read or the sound level is on. An audio mode set here before a read was therefore not written. SensorSoundLevel.isAudioConfigKnown() now takes the device and also counts an audio mode that differs from the one read, the same test configBytesGenerate() uses to write it. Off set before a read still leaves the Shimmer's own. API_00047 gains two tests; the first failed on the merged code. - API_00042_Shimmer3rAudioStatusTest is now API_00048: master's API_00042_EventRecordFileTest has that number. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…TATUS test Harith's 2610c37 added its test to API_00042_Shimmer3rAudioStatusTest, which this branch renamed to API_00048. Git carried the addition across the rename, so nothing needed resolving by hand. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DEV-1459. Brings
DEV-1459up to date with master, which now has #343 (DEV-971: configuration byte 232, the event channel probe, live event records and event files) merged at1e607084. Three commits on top of2610c374,DEV-1459's head.1. Merge master (
cbb0a157)Five files conflicted. Each conflict was two separate additions at the same place, so both sides are kept:
ShimmerBluetoothGET_AUDIO_STATUSbesideGET_EVENT_CHANNEL_STATUS), and the in-stream response branchesShimmerObjectConfigurationAUDIO_MODEbeside theBUTTON_MODE,LOG_TRIGGERSandTTL_INPUTlabelsConfigByteLayoutShimmer3SensorSoundLevelOn connect, the event channel probe still goes out early and
GET_AUDIO_STATUSlate.2. An audio mode set before a read is written (
35da512d)setAudioMode(), an audio mode set before a read was not written. The new testAPI_00047.anAudioModeSetBeforeAReadIsWrittenfailed on the merged code.SensorSoundLevel.isAudioConfigKnown()now takes the device. It also counts an audio mode that differs from the one read: the same testconfigBytesGenerate()uses to decide to write it. Off set before a read still leaves the Shimmer's own, since Off is also the default.API_00042_Shimmer3rAudioStatusTestis nowAPI_00048, because master'sAPI_00042_EventRecordFileTesthas that number.3. Merge DEV-1459 again (
ebeaa454)2610c374was pushed toDEV-1459after this PR opened. It addsunansweredAudioStatusKeepsTheConnectiontoAPI_00042_Shimmer3rAudioStatusTest, which this branch renames toAPI_00048, so GitHub reported a conflict. Git carried the new test across the rename, and nothing needed resolving by hand.Tests
API_00047_AudioConfigWriteTestAPI_00029_Shimmer3rAudioModeConfigByteTestAPI_00048_Shimmer3rAudioStatusTest(wasAPI_00042)2610c374's new testAPI_00038_EventChannelProbeTest,API_00046_ButtonLogModeConfigWriteTesttestclean buildshadowJar -PmatlabJava8)The
API_rows ran onebeaa454. The rest ran on35da512d; the merge since adds only a test. CI does not run on PRs into this branch. Not run on a unit.The Advance API and ConsensysApps
DEV-1459branches call none of what changed.🤖 Generated with Claude Code